<?php

namespace app\admin\model\vppz;

use think\Model;
use traits\model\SoftDelete;

class Company extends Model
{

    use SoftDelete;



    // 表名
    protected $name = 'vppz_company';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [
        'logo_url',
        'yingyezhizhao_url'
    ];

    public function area()
    {
        return $this->belongsTo('Area', 'area_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

	// 获取器直接转换url
	public function getLogoUrlAttr($value,$data)
    {
        return \addons\vppz\library\Vpower::dourl($data['logo']);
    }


	public function getYingyezhizhaoUrlAttr($value,$data)
    {
        return \addons\vppz\library\Vpower::dourl($data['yingyezhizhao']);
    }
}
